/**
 * 工作动态api
 * @author: chengcheng
 * @date: 2021-02-10
 */
import request from "@/utils/request";

/**
 *
 * @param {*} data
 * 保存工作动态数据
 */
export function saveOrUpdate(data) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH + "/infoManage/workNews/saveOrUpdate",
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: data
  });
}

/**
 * 查询分页数据
 * @param {*} params
 */
export function queryPages(params) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH + "/infoManage/workNews/queryPages",
    method: "get",
    params: params
  });
}

/**
 * 根据主键查询数据
 * @param {*} id
 */
export function getById(id) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/infoManage/workNews/getById/${id}`,
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}

/**
 * 根据id进行发布操作
 * @param {*} id
 */
export function publishById(id) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/infoManage/workNews/publishById/${id}`,
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}

//撤销
export function unPublishById(id) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/infoManage/workNews/unPublishById/${id}`,
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}

//删除
export function deleteById(id) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/infoManage/workNews/deleteById/${id}`,
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}
